// import axios from 'axios'
import request from './request'
// import qs from 'qs'
// 区分开发和生产环境 process.env.NODE_ENV (development == 开发 production 生产)
const preUrl = process.env.NODE_ENV == "development" ? "/api" : "";

// 登录接口
export const loginApi = (data) => request.post(preUrl + '/tokens', data)

// 获取部门列表
export const getDepartments = (params) => request.get(preUrl + "/departments", { params })

// 添加部门信息
export const addDepartment = (data) => request.post(preUrl + '/departments', data)

// 获取部门列表
export const getPermissions = (params) => request.get(preUrl + "/permissions", { params })

// 编辑部门信息
export const editDepartment = (data) => request.put(preUrl + '/departments/' + data.id, data)

// 删除部门
export const delDepartment = (params) => request.delete(preUrl + "/departments/" + params.id, { params })

// 获取员工列表
export const getEmployees = (params) => request.get(preUrl + "/employees", { params })

// 查询角色列表
export const getRoles = (params) => request.get(preUrl + "/roles", { params })

// 添加员工信息
export const addEmployees = (data) => request.post(preUrl + '/employees', data)

// 批量删除
export const delEmployees = (params) => request.delete(preUrl + "/employees", { params })

// 查询单个员工信息
export const getEmployee = (params) => request.get(preUrl + "/employees/" + params.id, { params })

// 修改单个员工的信息
export const editEmployee = (data) => request.put(preUrl + '/employees/' + data.id, data)

// 导出员工的信息
export const exportFileUrl = preUrl +  '/employees/xlses'

// 报表查询
export const getReportLists = (params) => request.get(preUrl + "/customers/reports/list", { params })
